<%--
  Created by IntelliJ IDEA.
  User: wen
  Date: 2018/7/3
  Time: 18:37
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>java题库添加页面</title>
    <script type="text/javascript"  src="/js/jquery-2.1.3.min.js"></script>
    <script type="text/javascript">
        function commit() {
            var question=$("#question").val();
            var answer=$("#answer").val();

            $.ajax({
                type:"POST",
                url: "/java/add.do",
                data:{question:question,answer:answer},
                success: function(data){
                    if(data.status == 0){
                         alert(data.msg);
                         /*window.location.href = "/view/java.jsp";*/

                    }else {
                        alert(data.msg);
                    }
                }
            });
        }
        function  begin() {
            window.location.href = "/view/java.jsp";
        }
    </script>
</head>
<form>
<p>设置问题</p><br>
<textarea cols="100" rows="2"id="question"></textarea>
<p>答案</p>
<textarea cols="100" rows="5" id="answer"></textarea>
</form>
<input type="button" value="提交" onclick="commit()">
<input type="submit" value="开始练题" onclick="begin()">
</body>
</html>
